# mellanox接口测试构建文件

if meson_build
    drivers_install_dir = meson.project_build_root() / 'opt/bmc/drivers'
else
    drivers_install_dir = 'opt/bmc/drivers/'
endif
run_command('mkdir', '-p', drivers_install_dir, check: false)

# mellanox接口源文件
mellanox_interface_sources = files(
  '../../../../../drivers/pcie_nic_card/mellanox/interface/board.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/network_adapter.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/network_port.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/optical_module.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/pcie_card.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/pcie_device.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/network_port/link_info.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/network_port/lldp_receive.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/network_port/metrics.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/network_adapter/cooling.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/optical_module/status.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/optical_module/cooling.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/optical_module/power.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/optical_module/voltage.cpp',
  '../../../../../drivers/pcie_nic_card/mellanox/interface/optical_module/current.cpp',
)

# mellanox接口测试源文件
test_mellanox_interface_sources = [
  '../../../../main.cpp',
  'test_board.cpp',
  'test_network_adapter.cpp',
  'test_network_port.cpp',
  'test_optical_module.cpp',
  'test_pcie_card.cpp',
  'test_pcie_device.cpp',
  'test_network_adapter_cooling.cpp',
  'network_port/test_link_info.cpp',
  'network_port/test_lldp_receive.cpp',
  'network_port/test_metrics.cpp',
  'optical_module/test_voltage.cpp',
  'optical_module/test_current.cpp',
  'optical_module/test_power.cpp',
  'optical_module/test_status.cpp',
  'optical_module/test_cooling.cpp',
  'mock_ipmi_core.cpp',
  '../../../../libraries/ncsi_over_mctp/mock_mctp.cpp',
] + mellanox_interface_sources

test_mellanox_interface = executable(
  'test_mellanox_interface',
  test_mellanox_interface_sources,
  include_directories: [
    include_directories('.'),
    include_directories('../..'),
    include_directories('../../../../../drivers/pcie_nic_card/mellanox'),
    include_directories('../../../../../drivers/internal'),
    include_directories('../../../../../include'),
    include_directories('../../../../../gen'),
    include_directories('../../../../../libraries'),
  ],
  dependencies: [
    gtest_dep,
    test_utilities_dep,
    test_utils_dep,
    libmcpp_deps,
    libncsi_over_mctp_dep,
    libmctp_dep,
    dev_deps,
  ],
  cpp_args: ['-DUNIT_TEST'],
  install: false,
)

test('test_mellanox_interface', test_mellanox_interface, suite: 'mellanox', timeout: 300, is_parallel: false)

